<template>
    <div>
        <!-- TypeNav 组件为全局组件，所以不需要再引入 -->
        <TypeNavIndex></TypeNavIndex>
        <Main></Main>
        <ModLike></ModLike>
        <Recommend></Recommend>
        <!-- 家用电器，手机通讯，电脑办公 -->
        <!-- 通过props配置项 给floor组件传递数据（floor） -->
        <Floor v-for="(floor) in floorList" :key="floor.id" :list="floor"></Floor>
    </div>

</template>

<script>
import Main from './Main'
import ModLike from './ModLike/index.vue';
import Recommend from './Recommend/index.vue';
import Floor from './Floor/index.vue';

import { mapState } from 'vuex'
export default {
    name: "HomeIndex",
    components: { Main, ModLike, Recommend, Floor },
    mounted() {
        this.$store.dispatch("getFloorList")

        // 获取用户信息在首页展示
        this.$store.dispatch("user/getUserInfo")

    },
    computed: {
        ...mapState({
            floorList: function (state) {
                return state.home.floorList;
            }
        })
    },

}
</script>

<style scoped lang="css">
</style>